// --------------------------------------------------------------------------------------- 
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// cause the object to move more rapidly.
var keyboardSpeed = 1.0;

// FixedUpdate is a built-in unity function that is called every fixed framerate frame.
// According to the docs, FixedUpdate should be used instead of Update when dealing with a
// Rigidbody.
// See http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.FixedUpdate.html 
// for more information.
function FixedUpdate () {


    // Get input from the keyboard, with automatic smoothing (GetAxis instead of GetAxisRaw).
    // We always want the movement to be framerate independent, so we multiply by Time.deltaTime.
    var keyboardX = Input.GetAxis("Horizontal") * keyboardSpeed * Time.deltaTime;
    var keyboardY = Input.GetAxis("Vertical") * keyboardSpeed * Time.deltaTime;

    // Calculate the new position based on the above input.
    // If you want to limit the movement, you can use Mathf.Clamp
    // to limit the allowed range of newPos.x or newPos.y.
    var newPos = rigidbody.position + Vector3(keyboardX, keyboardY, 0.0);

    // Move the object.
    rigidbody.MovePosition(newPos);
    

}

// Require a Rigidbody component to be attached to the same GameObject.
@script RequireComponent(Rigidbody)